package pucp.carpooling.adapter;

import pucp.carpooling.FragmentTab_aviso_conductor;
import pucp.carpooling.FragmentTab_aviso_pasajero;
import pucp.carpooling.FragmentTab_publicar_aviso;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class ViewPagerAdapter extends FragmentPagerAdapter {

	// Declare the number of ViewPager pages
	final int PAGE_COUNT = 3;
	private String titles[] = new String[] { "AVISOS DE PASAJEROS", "AVISOS DE CONDUCTORES", "PUBLICAR NUEVO AVISO"};

	public ViewPagerAdapter(FragmentManager fm) {
		super(fm);
		// TODO Auto-generated constructor stub
	}

	@Override
	public Fragment getItem(int position) {
		switch (position) {

		// Open FragmentTab1.java
		case 0:
			FragmentTab_aviso_pasajero fragmenttab2 = new FragmentTab_aviso_pasajero();
			
			return fragmenttab2;

			// Open FragmentTab2.java
		case 1:
			FragmentTab_aviso_conductor fragmenttab1 = new FragmentTab_aviso_conductor();
			return fragmenttab1;
			
		case 2:
			FragmentTab_publicar_aviso fragmenttab3 = new FragmentTab_publicar_aviso();
			return fragmenttab3;
		}
		return null;
	}
	
	public CharSequence getPageTitle(int position) {
		return titles[position];
	}
	@Override
	public int getCount() {
		return PAGE_COUNT;
	}

}
